<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core" >

    <p:dialog header="Editeaza profil" widgetVar="edit_user_profile_var" dynamic="true" minHeight="300" minWidth="400" modal="true">

        <h:form id="edit-user-form">
            <h:panelGrid columns="3">
                <p:outputLabel for="user-email" value="Adresa de e-mail:"/>
                <p:inputText id="user-email" value="#{administrationBean.selectedUser.email}"
                             required="true" requiredMessage="Adresa de e-mail necesara."/>
                <p:message for="user-email" />

                <p:outputLabel for="user-name" value="Nume utilizator:"/>
                <p:inputText id="user-name" value="#{administrationBean.selectedUser.username}" required="true" requiredMessage="Nume utilizator necesar."/>
                <p:message for="user-name" />

                <p:outputLabel for="old-user-password" value="Parola veche:"/>
                <p:password id="old-user-password" value="#{administrationBean.selectedUser.oldPassword}"
                            required="true" requiredMessage="Parola veche este obligatorie.">
                    <f:validateBean binding="#{userPasswordValidator}" />
                </p:password>
                <p:message for="old-user-password" />

                <p:outputLabel for="user-password" value="Parola noua:"/>
                <p:password id="user-password" value="#{administrationBean.selectedUser.password}"
                            match="user-confirm-password" label="Parola" required="true"/>
                <p:message for="user-password" />

                <p:outputLabel for="user-confirm-password" value="Confirma parola:"/>
                <p:password id="user-confirm-password" value="#{administrationBean.selectedUser.password}"
                            match="user-confirm-password" label="Confirma parola" required="true"/>
                <p:message for="user-confirm-password" />

            </h:panelGrid>

            <p:commandButton value="Salveaza" update="@form" actionListener="#{administrationBean.saveUserProfile}"
                             oncomplete="if (args &amp;&amp; !args.validationFailed) edit_user_profile_var.hide()"/>
            <p:commandButton value="Renunta" onclick="PF('edit_user_profile_var').hide();"/>
        </h:form>
    </p:dialog>


</ui:composition>
